//
//  CCBaseVC.m
//  Library
//
//  Created by hc-101 on 2019/11/6.
//  Copyright © 2019年 hc-101. All rights reserved.
//

#import "CCBaseVC.h"
#import "SelfHeader.h"


@interface CCBaseVC ()
/** <#Description#> */

@property (nonatomic ,strong) UIButton *backBtn;

@end

@implementation CCBaseVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.hidden  = YES;
    [self.view addSubview:self.topView];
    [self.topView addSubview:self.backBtn];
    [self.topView addSubview:self.centerLabel];
//    [self.topView addSubview:self.rightBtn];
    
    
    
    self.topView.frame  = CGRectMake(0, 0, SCREEN_WIDTH, Height_NavBar);
    self.backBtn.frame  = CGRectMake(10, Height_NavBar - 40, 40, 40);
    self.rightBtn.frame  = CGRectMake(SCREEN_WIDTH - 40 - 10, Height_NavBar - 40, 40, 40);
    
    self.centerLabel.frame  = CGRectMake(SCREEN_WIDTH*0.5-50, 0, 100, 44);
    self.centerLabel.centerY  = self.backBtn.centerY;
    
    // Do any additional setup after loading the view.
}

- (UILabel *)centerLabel{
    if(_centerLabel == nil) {
        
        _centerLabel  = [UILabel new];
        _centerLabel.text  =@"巡检拍照";
        _centerLabel.font  = [UIFont systemFontOfSize:18];
        _centerLabel.textAlignment  = NSTextAlignmentCenter;
        _centerLabel.textColor  = [UIColor colorWithHexString:@"#1a1a1a"];
        
    }
    
    return _centerLabel ;
}

-(UIButton *)backBtn{
    if(_backBtn ==nil){
        UIButton  *btn  =  [UIButton new];
        [btn setImage: [UIImage imageNamed:MYBUNDLE_ForImageName(@"icon_return")] forState:UIControlStateNormal];
//        NSString *a   = [NSBundle bundleWithPath: [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent: @"MainLibrary.bundle"]];
//
//
//
//        NSString *c  =[NSBundle bundleWithPath: [[NSBundle mainBundle] resourcePath] ];
//
//        NSString *b   = MYBUNDLE_ForImageName(@"icon_return");
        
        //[NSBundle bundleForClass:self.class]

        [btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
        _backBtn  = btn;
    }
    return _backBtn;
}

-(UIButton *)rightBtn{
    if(_rightBtn ==nil){
        UIButton  *btn  =  [UIButton new];
        [btn setImage: [UIImage imageNamed:MYBUNDLE_ForImageName(@"btn_czjl")] forState:UIControlStateNormal];
        [btn addTarget:self action:@selector(btnFullClick:) forControlEvents:UIControlEventTouchUpInside];
        _rightBtn  = btn;
    }
    return _rightBtn;
}

- (UIView *)topView{
    if(_topView==nil){
        _topView  = [[UIView alloc] init];
        _topView.backgroundColor  = UIColor.whiteColor;
        
    }
    return _topView;
}

-(void)btnClick{
    [self dismissViewControllerAnimated:NO completion:nil];
  
}

-(void)btnFullClick:(UIButton*)sender{
    
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
